package com.sam.im.heiqun.callmain;

import com.sam.im.heiqun.app.App;
import com.sam.im.heiqun.utils.ToolsUtils;

import org.json.JSONObject;

/**
 * Created by jack on 2017-07-15.
 */

public class IMMessage {

    /**
     * "{'content':'" + msg
     + "','destId':17068,
     'devType':3,
     'fromId':17150,
     'fromName':'姑姑家',
     'fromType':1,
     'imageIconUrl':'http://120.27.145.73/wmsMobile/upload/37901487490263526.png',
     'messageType':2,'msgId':'"+ System.currentTimeMillis() + "_" + Math.random() + "'}"
     * @return
     */
    public static JSONObject createSimpleMsg(String content,int messageType){
        JSONObject msg = new JSONObject();
        try {

            msg.put("content", content);
            msg.put("destId", App.rtcdestid);
            msg.put("fromId", ToolsUtils.getMyUserId());
            msg.put("devType",3);
            msg.put("fromName","姑姑家");
            msg.put("fromType",1);
            msg.put("imageIconUrl","http://120.27.145.73/wmsMobile/upload/37901487490263526.png");
            msg.put("messageType",messageType);
            msg.put("msgId",System.currentTimeMillis() + "_" + Math.random());
        } catch (Exception e) {
            e.printStackTrace();
        }

        return msg;
    }

    public JSONObject createMessage(String content,long destId,int devType,long fromId,String fromName,
                                    int fromType,String imageIconUrl,int messageType,String msgId){
        JSONObject msg = new JSONObject();
        try {
            msg.put("content", content);
            msg.put("destId", destId);
            msg.put("devType",devType);
            msg.put("fromId",fromId);
            msg.put("fromName",fromName);
            msg.put("fromType",fromType);
            msg.put("imageIconUrl",imageIconUrl);
            msg.put("messageType",messageType);
            msg.put("msgId",msgId);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return msg;
    }
}
